package deform;

import java.io.File;
import java.io.IOException;
import java.util.List;

import org.apache.commons.io.FileUtils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jjxliu.deform.model.ueform.field.Checkboxs;
import com.jjxliu.deform.model.ueform.field.FormField;
import com.jjxliu.deform.model.ueform.field.ListCtrl;
import com.jjxliu.deform.model.ueform.field.Radios;
import com.jjxliu.deform.model.ueform.field.Select;
import com.jjxliu.deform.model.ueform.field.Text;
import com.jjxliu.deform.model.ueform.field.TextArea;
import com.jjxliu.deform.utils.CommonUtils;

public class DeHtml {

	public static void main(String[] args) throws IOException {
		
		 String preg =  "(\\|-<span(((?!<span).)*leipiplugins=\"(radios|checkboxs|select)\".*?)>(.*?)<\\/span>-\\||<(img|input|textarea|select).*?(<\\/select>|<\\/textarea>|\\/>))";
			       
		
		// String preg =  ".*<input(?![^<>]*?leipiplugins[^<>]*?>)/>";
		 String preg_attr ="(\\w+)=\"(.*?)\"" ;
		 String preg_group ="<input.*?\\/>";
		 
		 String option_regex = "<option([^<>]*?)>(.*?)</option>" ;
			      
		 String content = FileUtils.readFileToString(new File("F:/lyf/lichao/表单设计/deform/src/main/resources/example/TEXT.txt"));
		 
		
		// System.out.println(content);
		 
		 String[] ms = CommonUtils.maches(content, preg);
		 for(String m : ms) {
			 
			   
			 FormField ff = FormField.parseText(m);
			 
			  
			 //System.out.println(m);
			 
			 String view = ff.getView("1");
			 
			 System.out.println(ff.getLeipiplugins() + " view:   " + view);
			 
			  
			 String edit = ff.getEdit("1");
			 System.out.println(ff.getLeipiplugins() + " edit:   " +  edit);
			 
			 
			// break ;
			 
		 }
		 

	}

}
